package com.future.domain.vo;

import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;


@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class HealthDetailVO {
    private Long userId;
    private String avatar;
    private String realName;
    private String className;
    private int totalSize;
    private int score;
    private int averageScore;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime completedAt;

    public int getAverageScore() {
        return totalSize ==0 ? 0 :  (int) (score *1.0 /totalSize);
    }
}
